#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int all_positive_num(int str[][10], int N, int M)
{
	int i = 0;
	int sum = 0;
	for (i = 0; i < N; i++)
	{
		int j = 0;
		for (j = 0; j < M; j++)
			if (str[i][j] > 0)
				sum += str[i][j];
	}
	return sum;
}

int main()
{
	int N = 0;
	int M = 0;
	int arr[10][10] = { 0 };
	scanf("%d %d", &N, &M);
	int i = 0, j = 0;
	for (i = 0; i < N; i++)
		for (j = 0; j < M; j++)
			scanf("%d", &arr[i][j]);
	int sum = 0;
	sum = all_positive_num(arr,N,M);
	printf("%d", sum);
}